package com.wuhao.springboot.controller;

import com.wuhao.springboot.common.Result;
import com.wuhao.springboot.entity.FaultDetection;
import com.wuhao.springboot.entity.Role;
import com.wuhao.springboot.service.IUserService;
import com.wuhao.springboot.service.RoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.management.relation.RoleList;
import java.util.List;

/**
 * @Description
 * @Date 2023/2/4 17:36
 * @Author pq
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Resource
    private RoleService roleService;

    @GetMapping("/roleList")
    public List<Role> roleList() {
        return roleService.roleList();
    }

    @GetMapping("/add")
    public int add(@RequestParam("roleName") String roleName) {
        return roleService.addRole(roleName);
    }

    @GetMapping("/delete")
    public void delete(@RequestParam("id") String id) {
        roleService.delete(id);
    }
}
